package good.idea.data.excel.entity;

import lombok.Data;

import java.util.ArrayList;
import java.util.List;

/**
 * @author chm
 */
@Data
public class TemplateTag {

    private String value;
    private String var;
    private String status;

    private String tagFlag;

    private int tagStartIndex;
    private int tagEndIndex;


    private int startRowIndex;
    private int endRowIndex;

    private int startCellIndex;
    private int endCellIndex;

    private int startIndex;
    private int endIndex;

    private String text;

    private TemplateTag parent;

    private List<TemplateTag> children = new ArrayList<>();

    public void initTagFlag() {
        if (this.tagFlag == null) {
            this.tagFlag = "start";
        } else {
            this.tagFlag = "end";
        }
    }

    public int getTagStartIndex() {
        return tagStartIndex;
    }

    public TemplateTag setTagStartIndex(int tagStartIndex) {
        this.tagStartIndex = tagStartIndex;
        this.setStartIndex(tagEndIndex);
        this.initTagFlag();
        return this;
    }

    public int getTagEndIndex() {
        return tagEndIndex;
    }

    public TemplateTag setTagEndIndex(int tagEndIndex) {
        this.tagEndIndex = tagEndIndex;
        this.setEndIndex(tagEndIndex);
        this.initTagFlag();
        return this;
    }
}
